package com.qf.util;

import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ConnUtil {
    static String  host = "192.168.199.109";
    static int port = 5672;
    static String virtualHost = "sh2004";
    static String username = "sh2004";
    static String password = "sh2004";


    public static Connection getConn(){
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost(host);
        factory.setPort(port);
        factory.setVirtualHost(virtualHost);
        factory.setUsername(username);
        factory.setPassword(password);

        Connection conn = null;
        try {
            conn = factory.newConnection();
        } catch (IOException | TimeoutException e) {
            e.printStackTrace();
        }

        return conn;
    }


}
